package com.my.zl.console.controller.autocode;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.my.zl.common.dto.ReqDTO;
import com.my.zl.common.dto.ResDTO;
import com.my.zl.common.dto.advancedQuery.PageQueryDTO;
import com.my.zl.console.common.aop.LogAnnotation;
import com.my.zl.console.controller.base.BaseController;
import com.my.zl.console.entity.autocode.ZlTemplateDtl;
import com.my.zl.console.dto.autocode.templateDtl.ReqTemplateDtlAddDTO;
import com.my.zl.console.dto.autocode.templateDtl.ReqTemplateDtlDelDTO;
import com.my.zl.console.dto.autocode.templateDtl.ReqTemplateDtlEditDTO;
import com.my.zl.console.dto.autocode.templateDtl.ReqTemplateDtlQueryDTO;
import com.my.zl.console.dto.autocode.templateDtl.ReqTemplateDtlDetailDTO;
import com.my.zl.console.dto.autocode.templateDtl.ReqTemplateDtlStateDTO;
import com.my.zl.console.dto.autocode.templateDtl.ResTemplateDtlAddDTO;
import com.my.zl.console.dto.autocode.templateDtl.ResTemplateDtlDelDTO;
import com.my.zl.console.dto.autocode.templateDtl.ResTemplateDtlEditDTO;
import com.my.zl.console.dto.autocode.templateDtl.ResTemplateDtlQueryDTO;
import com.my.zl.console.dto.autocode.templateDtl.ResTemplateDtlDetailDTO;
import com.my.zl.console.service.autocode.ITemplateDtlService;
import com.my.zl.console.dto.autocode.templateDtl.ResTemplateDtlStateDTO;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 模板明细
 * @author ZL
 */
@Api(value="模板明细",tags ="模板明细")
@RestController
@RequestMapping("/api/autocode/templateDtl")
public class TemplateDtlController extends BaseController {

    @Autowired
    private ITemplateDtlService templateDtlService;
    
    /**
     * 查询
     */
    @ApiOperation(value="模板明细-查询")
    @RequestMapping(value="/list", method = RequestMethod.GET)
    public ResDTO<ResTemplateDtlQueryDTO> listTemplateDtl(ReqTemplateDtlQueryDTO reqInfo,PageQueryDTO page) throws Exception{
        ResTemplateDtlQueryDTO data = templateDtlService.queryTemplateDtlList(reqInfo,page);
        return successDATA(data);
    }
    
   /**
     * 详情
     */
    @ApiOperation(value="模板明细-详情")
    @RequestMapping(value="/detail", method = RequestMethod.GET)
    public ResDTO<ResTemplateDtlDetailDTO> detailTemplateDtl(ReqTemplateDtlDetailDTO reqInfo) throws Exception{
        ResTemplateDtlDetailDTO data = templateDtlService.queryTemplateDtlDetail(reqInfo);
        return successDATA(data);
    }
    
    /**
     * 新增
     */
    @ApiOperation(value="模板明细-新增")
    @RequestMapping(value="/add", method = RequestMethod.POST)
    public ResDTO<ResTemplateDtlAddDTO> addTemplateDtl(@RequestBody ReqDTO<ReqTemplateDtlAddDTO> reqInfo) throws Exception{
        ResTemplateDtlAddDTO data = templateDtlService.insertTemplateDtlInfo(reqInfo);
        return successDATA(data);
    }
    
    /**
     * 编辑
     */
    @ApiOperation(value="模板明细-编辑")
    @RequestMapping(value="/edit", method = RequestMethod.POST)
    public ResDTO<ResTemplateDtlEditDTO> editTemplateDtl(@RequestBody ReqDTO<ReqTemplateDtlEditDTO> reqInfo) throws Exception{
        ResTemplateDtlEditDTO data = templateDtlService.updateTemplateDtlInfo(reqInfo);
        return successDATA(data);
    }
    
    /**
     * 删除
     */
    @ApiOperation(value="模板明细-删除")
    @RequestMapping(value="/del", method = RequestMethod.POST)
    public ResDTO<ResTemplateDtlDelDTO> delTemplateDtl(@RequestBody ReqDTO<ReqTemplateDtlDelDTO> reqInfo) throws Exception{
        ResTemplateDtlDelDTO data = templateDtlService.deleteTemplateDtlInfo(reqInfo);
        return successDATA(data); 
    }
    
    /**
     * 状态更新
     */
    @ApiOperation(value="模板明细-状态更新")
    @RequestMapping(value="/state", method = RequestMethod.POST)
    public ResDTO<ResTemplateDtlStateDTO> stateTemplateDtl(@RequestBody ReqDTO<ReqTemplateDtlStateDTO> reqInfo) throws Exception{
        ResTemplateDtlStateDTO data = templateDtlService.updateTemplateDtlState(reqInfo);
        return successDATA(data); 
    }
    
    
}